<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./echarts.js"></script>
</head>

<body>
    <div style="width: 100%;height:800px" id="main"></div>
</body>

</html>
<script>
    let main = document.querySelector('#main')
    let obj = echarts.init(main)
    let option = {
        series: [
            {
                // 关系图
                type: "graph",
                data: [
                    {
                        name: '韦小宝',
                        id: '1'
                    },
                    {
                        name: '郭靖',
                        id: '2'
                    },
                    {
                        name: '乔峰',
                        id: '3'
                    },
                    {
                        name: '张无忌',
                        id: '4'
                    },
                    {
                        name: '老师',
                        id: '5'
                    },
                ],
                // 图的布局
                layout: 'force',
                // 图形样式
                itemStyle: {
                    color: "green"
                },
                // 节点标记大小

                symbolSize: 20,
            }
        ]
    }
    obj.setOption(option)
</script>